package com.zycfc.zsf.boot.job.core;

import java.beans.*;

public class ZsfJobNodePath
{
    private static final String GUARANTEE_NODE = "guarantee";
    private static final String SET_CHAIN_NODE = "setting/chain";
    private static final String RESULT_NODE = "setting/execute/result";
    private static final String BATCH_NO_NODE = "setting/execute/batchno";
    private static final String ELECT_BATCH_NO_NODE = "setting/execute/electBatchNo";
    private static final String PRE_BATCH_NO_NODE = "setting/execute/preBatchNo";
    private static final String SET_BIZ_DATE = "setting/execute/bizDate";
    private static final String SET_START_TM = "setting/execute/startTime";
    private static final String SET_LOG_FLAG = "setting/execute/log";
    private static final String NAMESPACE_NODE = "setting/namespace";
    private static final String APPLICATION_NAME_NODE = "setting/applicationName";
    private static final String SHARDING_STRATEGY = "setting/shardingStrategy";
    private static final String SHARDING_FIXED_IP = "setting/shardingFixedIp";
    private static final String CONFIG_NODE = "config";
    private static final String SHARDING_NODE = "sharding";
    private static final String INSTANCES_NODE = "instances";
    private final String jobName;
    
    public String getFullPath(final String node) {
        return String.format("/%s/%s", this.jobName, node);
    }
    
    public String getInstancesNodePath() {
        return String.format("/%s/%s", this.jobName, "instances");
    }
    
    public String getInstanceNodePath(final String instanceId) {
        return String.format("%s/%s", this.getInstancesNodePath(), instanceId);
    }
    
    public String getShardingNodePath() {
        return String.format("/%s/%s", this.jobName, "sharding");
    }
    
    public String getShardingItemPath(final String item) {
        return String.format("%s/%s", this.getShardingNodePath(), item);
    }
    
    public String getShardingNodePath(final String item, final String nodeName) {
        return String.format("%s/%s/%s", this.getShardingNodePath(), item, nodeName);
    }
    
    public String getConfigNodePath() {
        return String.format("/%s/%s", this.jobName, "config");
    }
    
    public String getGuaranteeNodePath() {
        return String.format("/%s/%s", this.jobName, "guarantee");
    }
    
    public String getBizDateNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/bizDate");
    }
    
    public String getLogFlagNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/log");
    }
    
    public String getStartTmNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/startTime");
    }
    
    public String getResultNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/result");
    }
    
    public String getElectBatchNoNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/electBatchNo");
    }
    
    public String getPreBatchNoNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/preBatchNo");
    }
    
    public String getBatchNoNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/execute/batchno");
    }
    
    public String getChainNodePath() {
        return String.format("/chain/%s/%s", this.jobName, "setting/chain");
    }
    
    public String getNamespaceNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/namespace");
    }
    
    public String getApplicationNameNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/applicationName");
    }
    
    public String getShardingStrategyNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/shardingStrategy");
    }
    
    public String getShardingFixedIpNodePath() {
        return String.format("/%s/%s", this.jobName, "setting/shardingFixedIp");
    }
    
    public String setSwitchNodePath() {
        return String.format("/switch/%s", this.jobName);
    }
    
    @ConstructorProperties({ "jobName" })
    public ZsfJobNodePath(final String jobName) {
        this.jobName = jobName;
    }
}
